package com.feicheng.house.wcpay.serviceImpl;

import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSON;

import com.feicheng.house.entity.BuyOrder;
import com.feicheng.house.entity.Deposit;
import com.feicheng.house.result.ResultInfo;
import com.feicheng.house.wcpay.service.TuiKuanService;

import pojo.shenQingTuiKuan;

public class TuiKuanServiceImpl implements TuiKuanService{
	@Override
	public ResultInfo refund(shenQingTuiKuan shenQingTuiKuan) {
		
		Deposit deposit = new Deposit();
		if (deposit.getDepositState().equals("已充值")) {
			Map< Object, Object> map = new HashMap<Object, Object>();
			map.put("out_trade_no", shenQingTuiKuan.getOut_trade_no());
			map.put("out_refund_no", shenQingTuiKuan.getOut_refund_no());
			map.put("reason", shenQingTuiKuan.getReason());
			map.put("notify_url", shenQingTuiKuan.getNotify_url());
			
			Map<Object, Object> map2 = new HashMap<Object, Object>();
			map2.put("refund", shenQingTuiKuan.getRefund());
			map2.put("total",shenQingTuiKuan.getTotal() );
			map2.put("currency", shenQingTuiKuan.getCurrency());
			map.put("amount", map2);
			
			String josn = JSON.toJSONString(map);
			String url = "https://api.mch.weixin.qq.com/v3/refund/domestic/refunds";
			String urlString  =  util.HttpRequest.sendPost(url, josn);
			
			if (josn.indexOf("SUCCESS") != -1) {
				
			
			}
			Map<Object, Object> map3 = (Map) JSON.parse(url);
			
		}
		return null;
		
	}

}
